#include ../make.inc

INC_CONCURRENCY = -I /home/ycc/empty_server/concurrency/include
LIB_CONCURRENCY = -L /home/ycc/empty_server/concurrency/lib -l concurrency

LIB_TARGET = lib/libnetkit.a

INC_DIR = include/ $(INC_CONCURRENCY)
SRC_DIR= src/
OBJ_DIR= obj/
LIB_DIR = lib/ 

INC = -I $(INC_DIR)

OBJ_EXT= .o
CXXSRC_EXT= .cpp
CSRC_EXT= .c

SRCS = $(wildcard src/*.cpp)
SRCS1 = $(notdir $(SRCS))
OBJECTS = $(patsubst %.cpp, obj/%.o, $(SRCS1))

$(LIB_TARGET): $(OBJECTS)
	@echo
	@echo "$(OBJECTS) ==> $@"
	@$(AR) rc $(LIB_TARGET) $(OBJECTS)

$(OBJ_DIR)%$(OBJ_EXT): $(SRC_DIR)%$(CXXSRC_EXT) 
	@echo
	@echo "Compiling $< ==> $@..."
	$(CXX) $(INC) $(C_FLAGS) -c $< -o $@

$(OBJ_DIR)%$(OBJ_EXT): $(SRC_DIR)/data/%$(CXXSRC_EXT) 
	@echo 
	@echo "Compiling $< ==> $@..."
	$(CXX) $(INC) $(C_FLAGS) -c $< -o $@

all: $(LIB_TARGET) 

test:
	echo $(OBJECTS)

clean:
	find ./ -name *.o -exec rm -rf {} \;
	find ./ -name *.a -exec rm  -rf {} \;


